/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DAO;

import DAO.Iter.HocPhanDAO;
import TableModel.Hocphan;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;


/**
 *
 * @author vt
 */
public class HocPhanDAOImpl extends HibernateDaoSupport implements HocPhanDAO {
    
    @Override
    public Hocphan findHocPhan(String id) {
         List list = this.getHibernateTemplate().find("from Hocphan hocphan where hocphan.mahp = ?", id);
		if(list.isEmpty()){
			return null;
		}
		return (Hocphan) list.get(0);

    }
    @Override
    public List<Hocphan> findAllLop() {
        return this.getHibernateTemplate().find("from Hocphan hp order by hp.mahp");
    }

    @Override
    public void add(Hocphan a) {
        Serializable save = getHibernateTemplate().save(a);
    }

    @Override
    public void delete(Hocphan a) {
        getHibernateTemplate().delete(a);
    }

    @Override
    public void edit(Hocphan a) {
        getHibernateTemplate().update(a);
    }
    @Override
    public List<Hocphan> findLopByHocKy(String idHocKy) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public List<Hocphan> findLopByGiaoVien(String idGiaoVien) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public List<Hocphan> findLopByMonHoc(String idMonHoc) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public Hocphan findLop(Date ngaybatdau) {
       return null;
    }

    @Override
    public List<Hocphan> findLopBeginLess(Date ngaybatdau) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    
}
